import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
import apply from "./modules/apply";
import charge from "./modules/charge";
import findpwd from "./modules/findpwd";
import home from "./modules/home";
import login from "./modules/login";
import management from "./modules/management";
import medicine from "./modules/medicine";
import newcome from "./modules/newcome";
import register from "./modules/register";
import VIP from "./modules/VIP";
import workspace from "./modules/workspace";

export default new Vuex.Store({
  state: {
    routes: [], // 菜单列表
    name: "",
  },
  mutations: {
    addRoutes(state, params) {
      // state.routes = routes;
      // console.log(state.routes);
      state.name = params.nickobj[0];
      state.routes = params.routes[4].children;
      // console.log(state.name);
    },
  },
  actions: {
    addRoutesAction({ commit }, params) {
      commit("addRoutes", params);
    },
  },
  modules: {
    apply,
    charge,
    findpwd,
    home,
    login,
    management,
    medicine,
    newcome,
    register,
    VIP,
    workspace,
  },
});
